package com.bristua.barcode.customer.biz;

import com.bristua.barcode.customer.dao.TCustomerAccountMapper;
import com.bristua.barcode.customer.model.TCustomerAccount;
import com.bristua.barcode.customer.model.condition.TCustomerAccountExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2019/8/26.
 */
@Service
public class CustomerIsHaveSetPwdBiz {

    @Autowired
    private GetCustomerIdBiz getCustomerIdBiz;

    @Resource
    private TCustomerAccountMapper tCustomerAccountMapper;

    public boolean isSetCustomerBankPwd(){
        String customerId = getCustomerIdBiz.getCustomerId();
        TCustomerAccountExample tCustomerAccountExample = new TCustomerAccountExample();
        tCustomerAccountExample.createCriteria().andCustomerIdEqualTo(customerId);
        List<TCustomerAccount> tCustomerAccounts = tCustomerAccountMapper.selectByExample(tCustomerAccountExample);
        if(tCustomerAccounts!=null && tCustomerAccounts.size()>0){
            TCustomerAccount tCustomerAccount = tCustomerAccounts.get(0);
            if(StringUtils.isEmpty(tCustomerAccount.getAccountPwd())){
                return false;
            }else{
                return true;
            }

        }

        return false;
    }
}
